﻿using dz.u9.jky.schema.Attrib;
using dz.u9.jky.schema.Common;
using System;
using System.Collections.Generic;

namespace dz.u9.jky.schema.InvDoc
{
    /// <summary>
    /// 调入单
    /// </summary>
    public class DzTransferIn
    {
        /// <summary>
        /// 单据类型
        /// </summary>
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string TransInDocType { get; set; }

        /// <summary>
        /// 调入类型 调入类型 0为一步式 1为两步式
        /// </summary>
        [DzEnum("UFIDA.U9.InvDoc.Enums.TransferTypeEnum,UFIDA.U9.InvDoc.InvDocBE")]
        public int TransferType { get; set; } = 0;

        /// <summary>
        /// 组织
        /// </summary>
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string Org { get; set; }

        public DateTime BusinessDate { get; set; }

        /// <summary>
        /// 弹性域
        /// </summary>
        [DzComplexObject("UFIDA.U9.Base.FlexField.DescFlexField.DescFlexSegments,UFIDA.U9.Base.BaseBE")]
        public DescFlexField DescFlexField { get; set; }


        [DzEnum("UFIDA.U9.CBO.SCM.Enums.BusinessOperatorTypeEnum,UFIDA.U9.CBO.SCMBE")]
        public int OperationType { get; set; } = 0;

        [DzList("UFIDA.U9.ISV.TransferInISV.IC_TransInLineDTO,UFIDA.U9.ISV.TransferInISV")]
        public List<DzTransInLine> TransInLines { get; set; }
    }

    public class DzTransInLine
    {
        [DzSimpleObject("UFIDA.U9.CBO.SCM.Item.ItemInfo,UFIDA.U9.CBO.PubBE", "ItemCode")]
        public string ItemInfo { get; set; }

        /// <summary>
        /// 成本数量
        /// </summary>
        public decimal CostUOMQty { get; set; }

        /// <summary>
        /// 调入数量
        /// </summary>
        public decimal StoreUOMQty { get; set; }

        /// <summary>
        /// 调入仓库
        /// </summary>        
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string TransInWh { get; set; }

        [DzList("UFIDA.U9.ISV.TransferInISV.IC_TransInSubLineDTO,UFIDA.U9.ISV.TransferInISV")]
        public List<DzTransInSubLine> TransInSubLines { get; set; }

        [DzList("UFIDA.U9.ISV.TransferInISV.IC_TransInBinDTO,UFIDA.U9.ISV.TransferInISV")]
        public List<DzTransInBin> TransInBins { get; set; }
    }

    public class DzTransInSubLine
    {
        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string TransOutOrg { get; set; }

        [DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        public string TransOutWh { get; set; }

        [DzList("UFIDA.U9.ISV.TransferInISV.IC_TransInBinDTO,UFIDA.U9.ISV.TransferInISV")]
        public List<DzTransInBin> TransInBins { get; set; }
    }

    public class DzTransInBin
    {
        public decimal StoreUOMQty { get; set; }

        //[DzSimpleObject("UFIDA.U9.CBO.Pub.Controller.CommonArchiveDataDTO,UFIDA.U9.CBO.PubSV")]
        //public string Org { get; set; }

        /// <summary>
        /// 弹性域
        /// </summary>
        [DzComplexObject("UFIDA.U9.Base.FlexField.DescFlexField.DescFlexSegments,UFIDA.U9.Base.BaseBE")]
        public DescFlexField DescFlexSegments { get; set; }

        [DzComplexObject("UFIDA.U9.CBO.SCM.Bin.BinInfo,UFIDA.U9.CBO.PubBE")]
        public DzBinInfo BinInfo { get; set; }
    }
}
